package ext.tianma.bom.service.sourcingInterface;

import ext.com.iba.IBAUtil;
import ext.tianma.bom.util.StringUtil;
import ext.tianma.part.util.IbaAttributeUtil;
import wt.part.WTPart;

/**
 * 用于sourcing通知原材料工作流相关验证
 * 
 * @author laichao_sun
 *
 */
public class SourcingCheckUtil {
	public static String success = "审核通过";

	/**
	 * 用于判断sourcing审核bom是否通过
	 * 
	 * @return
	 */
	public static boolean isSuccess(Object object) {
		try {
			if (object instanceof WTPart) {
				// 传递的部件
				WTPart part = (WTPart) object;

				String string = (String) IBAUtil.getIBAValue(part, "SourcingRejectReason");
				if (StringUtil.isNullOrEmpty(string)) {
					return false;
				}
				if(string.equals(success)) {
					return true;
				}
				
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
		return false;
	}

}
